home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / util / cli / gengui21.lha / Gengui2.1 / Examples / backfillhook.h next >
C/C++ Source or Header  |  1995-06-18  |  1KB  |  45 lines

  1.  
  2. #ifndef BACKFILLHOOK
  3. #define BACKFILLHOOK
  4.  
  5. #include <graphics/gfxmacros.h>
  6.  
  7. struct LMsg {
  8.    struct Layer *Layer;
  9.    WORD   MinX,MinY; /* Coordinates in the screen */
  10.    WORD   MaxX,MaxY;
  11.    LONG OffsetX,OffsetY; /* Coordinates in the window */
  12. };
  13.  
  14. ULONG __interrupt __saveds __asm HookFunc(register __a0 struct Hook *hook,
  15.                                  register __a2 struct RastPort *rastport,
  16.                                  register __a1 struct LMsg *msg)
  17. {
  18.    struct RastPort rp=*rastport;
  19.    ULONG color;
  20.  
  21.    static __chip USHORT bitmap[]={0xaaaa,0x5555,0xaaaa};
  22.  
  23.    rp.Layer=NULL;
  24.  
  25.    color=(ULONG)hook->h_Data;
  26.  
  27.    SetAPen(&rp,color>>16);
  28.    SetBPen(&rp,color&0xffff);
  29.    SetDrMd(&rp,JAM2);
  30.  
  31.    /* Adjust the pattern to the window position */
  32.  
  33.    if((msg->MinX ^ msg->MinY ^ msg->OffsetX ^ msg->OffsetY) & 1)
  34.                                          {SetAfPt(&rp,(bitmap+1),1);} else
  35.                                          {SetAfPt(&rp,bitmap,1);}
  36.  
  37.    RectFill(&rp,msg->MinX,msg->MinY,msg->MaxX,msg->MaxY);
  38.  
  39.    return(0);
  40. }
  41.  
  42. #define COLOR(a,b) (void *)(((a)<<16)|b)
  43.  
  44. #endif
  45.